#ifndef SKYID_ANIMATION_H 
#define SKYID_ANIMATION_H

#include "common.h"
#include "object.h"
#include "texture.h"
#include "sprite.h"

namespace SkyID 
{

//- Animation -----------------------------------------------------------------

enum AnimationMode
{
	ANIM_FORWARD  = 1,
	ANIM_BACKWARD = 2
};

class Animation : public Sprite
{
public:
	Animation(const Texture *texture, int32 frames, int32 fps,
		float x, float y, float w, float h);
	virtual ~Animation();

	void update(float dt);

	void play();
	void stop() { mPlaying = false; }
	void setMode(AnimationMode mode);

	bool playing() const { return mPlaying; }

protected:
	void setFrame(int32 frame);

protected:
	int32 mFrames, mFrame, mDelta;
	float mSpeed, mTime;
	float mX, mY;
	bool mPlaying;
	AnimationMode mMode;
};

} // namespace SkyID

#endif // SKYID_ANIMATION_H
